#定义动态库的名字
LIBNAME=gettemp
#库文件的路径
LIBPATH=`pwd`/../lib

CC=gcc
AR=ar

all:dynamic_lib static_lib
	@make clear
	@make install

dynamic_lib:
	#gcc get_temp  dynamic_lib
	${CC} -shared -fPIC socket.c sql_action.c get_temp.c sqlite3.c -o libtempall.so -ldl -I ./sqlite-autoconf-3380200/ -llogger -L ~/lib/ -I ~/lib/


static_lib:
	#gcc get_temp static_lib
	${CC} -c get_temp.c -o get_temp.o -lloger -L ~/lib/ -I ~/lib/ -I ./sqlite-autoconf-3380200/
	#gcc sql_action static_lib
	${CC} -c sql_action.c -o sql_action.o -lloger -L ~/lib/ -I ~/lib/ -I ./sqlite-autoconf-3380200/
	#gcc socketinit static_lib
	${CC} -c socket.c -o socketinit.o -llogger -I ~/lib/ -L ~/lib/ 
	${AR} -rcs libtempall.a get_temp.o sql_action.o socketinit.o

clear:
	rm -f *.o

install:
	#cp -rf lib${LIBNAME}.* ${LIBPATH}
	cp -rf lib*.* ${LIBPATH}
	cp -rf *.h ${LIBPATH}
uninstall:
	rm -rf ${LIBPATH}/*.so
	rm -rf ${LIBPATH}/*.h

clean:clear
	rm -f lib*.*
